import React, { Component } from 'react';
import {
  View,
  StyleSheet,
  Image,
  TouchableOpacity,
} from 'react-native';

import NavBar from '../../../components/PublicHeader';
import ImageViewer from 'react-native-image-zoom-viewer';


export default class friendAvatar extends Component {
  constructor(props) {
    super(props);
    const {
      friendAvatar,
      defaultTrue
    } = this.props.navigation.state.params
    this.state = {
      url: friendAvatar,
      defaultTrue: defaultTrue
    };
  }

  componentDidMount = () => {

  };

  render() {
    const {
      defaultTrue
    } = this.state
    return (
      // 展示图片详情
      <View style={{ flex: 1, backgroundColor: '#000' }}>
        <NavBar
          backgroundColor={'#000'}
          titleColor={defaultTrue ?
            "#fff" : null}
          title={defaultTrue ?
            "营业执照查看" : ""}
          navigation={this.props.navigation}
        />
        <View style={styles.box}>
          <ImageViewer style={styles.avatar}
            imageUrls={this.state.url}
            enableImageZoom={true}
            enableSwipeDown={false}
            saveToLocalByLongPress={false}
            onClick={() => { // 图片单击事件
              this.props.navigation.goBack()
            }}
            renderHeader={() => {

            }}
          ></ImageViewer>
          {/* <Image style={styles.avatar} source={{ uri: this.state.avatar }} /> */}
        </View>
      </View>
    );
  }
}
const styles = StyleSheet.create({
  box: {
    alignItems: 'center',
    justifyContent: 'center',
    height: '80%',
    width: '100%'
  },
  avatar: {
    width: '100%',
    height: 400,
  }
});
